import 'package:flutter_test/flutter_test.dart';
import 'package:component_location/component_location.dart';
import 'package:component_location/component_location_platform_interface.dart';
import 'package:component_location/component_location_method_channel.dart';
import 'package:plugin_platform_interface/plugin_platform_interface.dart';

class MockComponentLocationPlatform
    with MockPlatformInterfaceMixin
    implements ComponentLocationPlatform {

  @override
  Future<String?> getPlatformVersion() => Future.value('42');
}

void main() {
  final ComponentLocationPlatform initialPlatform = ComponentLocationPlatform.instance;

  test('$MethodChannelComponentLocation is the default instance', () {
    expect(initialPlatform, isInstanceOf<MethodChannelComponentLocation>());
  });

  test('getPlatformVersion', () async {
    ComponentLocation componentLocationPlugin = ComponentLocation();
    MockComponentLocationPlatform fakePlatform = MockComponentLocationPlatform();
    ComponentLocationPlatform.instance = fakePlatform;

    expect(await componentLocationPlugin.getPlatformVersion(), '42');
  });
}
